﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NHibernateSample.Domain.ValueObjects;
using Iesi.Collections.Generic;

namespace NHibernateSample.Domain.Entities
{
    public class Customer
    {
        public virtual int Id { get; set; }
        //版本控制
        public virtual int Version { get; set; }
        public virtual Name Name { get; set; }
        public virtual string FirstName
        {
            get { return Name.FirstName; }
            set
            {
                if (Name != null)
                    Name.FirstName = value;
                else
                {
                    Name = new Name();
                    Name.FirstName = value;
                }
            }
        }
        public virtual string LastName
        {
            get { return Name.LastName; }
            set
            {
                if (Name != null)
                    Name.LastName = value;
                else
                {
                    Name = new Name();
                    Name.LastName = value;
                }
            }
        }
        //一对多关系：Customer有一个或多个Orders
        public virtual ISet<Order> Orders { get; set; }


    }
}
